<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023-12-05
  Time: 18:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>Title</title>
</head>
<body>
<jsp:useBean id="user" class="com.example.demo.User" scope="page"></jsp:useBean>
<jsp:setProperty name="user" property="*"/>
<%
  if (user.isValidate()){
    session.setAttribute("user",user);
%>
<jsp:forward page="index.jsp"></jsp:forward>
<%
  }else {
    response.sendRedirect("login.jsp?userName="+user.getUserName());
  }
%>
</body>
</html>